package pl.nazaweb.jboot.afk;

import java.awt.AWTException;
import java.awt.Point;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Marek Kawczyński
 */
public class AutoLogCallback implements ICallback {

    Robot robot;

    public AutoLogCallback() {
        try {
            robot = new Robot();

        } catch (AWTException ex) {
            System.err.println(ex.getMessage());
        }
    }

    @Override
    public void execute() {
        System.out.println("callback");
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_Q);
        robot.keyRelease(KeyEvent.VK_Q);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        try {
            new MouseClickCallback(new Point(606, 437)).execute();
        } catch (AWTException ex) {
            Logger.getLogger(AutoLogCallback.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
